package com.hz.service.impl;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.fastjson.JSONObject;
import com.hz.pojo.User;

import java.beans.ExceptionListener;
import java.util.ArrayList;
import java.util.List;

/**
 * <p>description</p >
 *
 * @author slj
 * @version 1.0
 * @date 2022/07/13 15:53
 */
public class ExcelListener extends AnalysisEventListener<User> {


    private List<User> list = new ArrayList<>();

    private static final int BATCH_COUNT = 5;


    @Override
    public void invoke(User user, AnalysisContext analysisContext) {
        System.out.println("解析到一条数据:========================"+JSONObject.toJSONString(user));
        // 数据存储到datas，供批量处理，或后续自己业务逻辑处理。
        list.add(user);

    }



    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {

    }
}
